﻿namespace HRM.CORE.Option
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Grid;
    using APP.HELPER;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms; using Common;
    using Common;
    using DevExpress.XtraGrid.Views.Base;

    public class xucFooterReportOption : Common.xucBase
    {
        private SimpleButton btFontFullName;
        private SimpleButton btFontPosition;
        private SimpleButton btFontRequire;
        private CalcEdit calHeightFooter;
        private CalcEdit calSpaceAbove;
        private CheckEdit cheIsShowFullName;
        private GridColumn colFullName;
        private GridColumn colIsOther;
        private GridColumn colIsSalary;
        private GridColumn colIsTimekeeper;
        private GridColumn colPosition;
        private GridColumn colRequire;
        private IContainer components = null;
        private FontDialog fontDialog1;
        private GridView gbList;
        private GridControl gcList;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl4;
        private LabelControl labelControl5;
        private LabelControl labelControl6;
        private LabelControl labelControl7;
        private TextEdit txtFontFullName;
        private TextEdit txtFontPosition;
        private TextEdit txtFontRequire;
        private string xmlFormatOptionPath = (Application.StartupPath + @"\Layout\footerReportFormatOption.xml");
        private string xmlListOptionPath = (Application.StartupPath + @"\Layout\footerReportListOption.xml");

        public xucFooterReportOption()
        {
            this.InitializeComponent();
        }

        private void btFontFullName_Click(object sender, EventArgs e)
        {
            FontConverter converter = new FontConverter();
            this.fontDialog1.Font = this.txtFontFullName.Font;
            if (this.fontDialog1.ShowDialog() != DialogResult.Cancel)
            {
                this.txtFontFullName.Font = this.fontDialog1.Font;
                this.txtFontFullName.Text = converter.ConvertToString(this.fontDialog1.Font);
            }
        }

        private void btFontPosition_Click(object sender, EventArgs e)
        {
            FontConverter converter = new FontConverter();
            this.fontDialog1.Font = this.txtFontPosition.Font;
            if (this.fontDialog1.ShowDialog() != DialogResult.Cancel)
            {
                this.txtFontPosition.Font = this.fontDialog1.Font;
                this.txtFontPosition.Text = converter.ConvertToString(this.fontDialog1.Font);
            }
        }

        private void btFontRequire_Click(object sender, EventArgs e)
        {
            FontConverter converter = new FontConverter();
            this.fontDialog1.Font = this.txtFontRequire.Font;
            if (this.fontDialog1.ShowDialog() != DialogResult.Cancel)
            {
                this.txtFontRequire.Font = this.fontDialog1.Font;
                this.txtFontRequire.Text = converter.ConvertToString(this.fontDialog1.Font);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void gbList_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                this.gbList.DeleteSelectedRows();
            }
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {
        }

        private void InitializeComponent()
        {
            this.gcList = new DevExpress.XtraGrid.GridControl();
            this.gbList = new DevExpress.XtraGrid.Views.Grid.GridView();
            this.colPosition = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colFullName = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colRequire = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colIsTimekeeper = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colIsSalary = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colIsOther = new DevExpress.XtraGrid.Columns.GridColumn();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.txtFontFullName = new DevExpress.XtraEditors.TextEdit();
            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
            this.calHeightFooter = new DevExpress.XtraEditors.CalcEdit();
            this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
            this.btFontRequire = new DevExpress.XtraEditors.SimpleButton();
            this.txtFontRequire = new DevExpress.XtraEditors.TextEdit();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
            this.btFontFullName = new DevExpress.XtraEditors.SimpleButton();
            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.btFontPosition = new DevExpress.XtraEditors.SimpleButton();
            this.txtFontPosition = new DevExpress.XtraEditors.TextEdit();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.cheIsShowFullName = new DevExpress.XtraEditors.CheckEdit();
            this.calSpaceAbove = new DevExpress.XtraEditors.CalcEdit();
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.fontDialog1 = new System.Windows.Forms.FontDialog();
            ((System.ComponentModel.ISupportInitialize)(this.gcList)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gbList)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontFullName.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.calHeightFooter.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontRequire.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontPosition.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheIsShowFullName.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.calSpaceAbove.Properties)).BeginInit();
            this.SuspendLayout();
            // 
            // gcList
            // 
            this.gcList.Cursor = System.Windows.Forms.Cursors.Default;
            this.gcList.Dock = System.Windows.Forms.DockStyle.Fill;
            this.gcList.Location = new System.Drawing.Point(3, 17);
            this.gcList.MainView = this.gbList;
            this.gcList.Name = "gcList";
            this.gcList.Size = new System.Drawing.Size(467, 169);
            this.gcList.TabIndex = 0;
            this.gcList.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
            this.gbList});
            // 
            // gbList
            // 
            this.gbList.Appearance.HeaderPanel.Options.UseTextOptions = true;
            this.gbList.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            this.gbList.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            this.gbList.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            this.gbList.ColumnPanelRowHeight = 32;
            this.gbList.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            this.colPosition,
            this.colFullName,
            this.colRequire,
            this.colIsTimekeeper,
            this.colIsSalary,
            this.colIsOther});
            this.gbList.FixedLineWidth = 1;
            this.gbList.GridControl = this.gcList;
            this.gbList.Name = "gbList";
            this.gbList.OptionsCustomization.AllowFilter = false;
            this.gbList.OptionsCustomization.AllowSort = false;
            this.gbList.OptionsFilter.AllowFilterEditor = false;
            this.gbList.OptionsSelection.InvertSelection = true;
            this.gbList.OptionsView.EnableAppearanceEvenRow = true;
            this.gbList.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
            this.gbList.OptionsView.ShowAutoFilterRow = true;
            this.gbList.OptionsView.ShowGroupPanel = false;
            this.gbList.OptionsView.ShowIndicator = false;
            this.gbList.OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.False;
            this.gbList.ViewCaption = "Danh sách người ký";
            this.gbList.KeyDown += new System.Windows.Forms.KeyEventHandler(this.gbList_KeyDown);
            // 
            // colPosition
            // 
            this.colPosition.Caption = "Chức danh";
            this.colPosition.FieldName = "Position";
            this.colPosition.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
            this.colPosition.Name = "colPosition";
            this.colPosition.Visible = true;
            this.colPosition.VisibleIndex = 1;
            this.colPosition.Width = 68;
            // 
            // colFullName
            // 
            this.colFullName.Caption = "Họ tên";
            this.colFullName.FieldName = "FullName";
            this.colFullName.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
            this.colFullName.Name = "colFullName";
            this.colFullName.Visible = true;
            this.colFullName.VisibleIndex = 0;
            this.colFullName.Width = 132;
            // 
            // colRequire
            // 
            this.colRequire.Caption = "Yêu cầu";
            this.colRequire.FieldName = "Require";
            this.colRequire.Name = "colRequire";
            this.colRequire.Visible = true;
            this.colRequire.VisibleIndex = 5;
            this.colRequire.Width = 98;
            // 
            // colIsTimekeeper
            // 
            this.colIsTimekeeper.Caption = "Chấm công";
            this.colIsTimekeeper.FieldName = "IsTimekeeper";
            this.colIsTimekeeper.Name = "colIsTimekeeper";
            this.colIsTimekeeper.Visible = true;
            this.colIsTimekeeper.VisibleIndex = 2;
            this.colIsTimekeeper.Width = 46;
            // 
            // colIsSalary
            // 
            this.colIsSalary.Caption = "Tính lương";
            this.colIsSalary.FieldName = "IsSalary";
            this.colIsSalary.Name = "colIsSalary";
            this.colIsSalary.Visible = true;
            this.colIsSalary.VisibleIndex = 3;
            this.colIsSalary.Width = 49;
            // 
            // colIsOther
            // 
            this.colIsOther.Caption = "Khác";
            this.colIsOther.FieldName = "IsOther";
            this.colIsOther.Name = "colIsOther";
            this.colIsOther.Visible = true;
            this.colIsOther.VisibleIndex = 4;
            this.colIsOther.Width = 38;
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.gcList);
            this.groupBox1.Location = new System.Drawing.Point(13, 155);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(473, 189);
            this.groupBox1.TabIndex = 1;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Danh sách người ký";
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.txtFontFullName);
            this.groupBox2.Controls.Add(this.labelControl7);
            this.groupBox2.Controls.Add(this.labelControl6);
            this.groupBox2.Controls.Add(this.calHeightFooter);
            this.groupBox2.Controls.Add(this.labelControl5);
            this.groupBox2.Controls.Add(this.btFontRequire);
            this.groupBox2.Controls.Add(this.txtFontRequire);
            this.groupBox2.Controls.Add(this.labelControl4);
            this.groupBox2.Controls.Add(this.btFontFullName);
            this.groupBox2.Controls.Add(this.labelControl3);
            this.groupBox2.Controls.Add(this.btFontPosition);
            this.groupBox2.Controls.Add(this.txtFontPosition);
            this.groupBox2.Controls.Add(this.labelControl2);
            this.groupBox2.Controls.Add(this.cheIsShowFullName);
            this.groupBox2.Controls.Add(this.calSpaceAbove);
            this.groupBox2.Controls.Add(this.labelControl1);
            this.groupBox2.Location = new System.Drawing.Point(13, 10);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(473, 139);
            this.groupBox2.TabIndex = 2;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Định dạng";
            this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter);
            // 
            // txtFontFullName
            // 
            this.txtFontFullName.Location = new System.Drawing.Point(249, 108);
            this.txtFontFullName.Name = "txtFontFullName";
            this.txtFontFullName.Properties.ReadOnly = true;
            this.txtFontFullName.Size = new System.Drawing.Size(170, 20);
            this.txtFontFullName.TabIndex = 7;
            this.txtFontFullName.EditValueChanged += new System.EventHandler(this.txtFontFullName_EditValueChanged);
            // 
            // labelControl7
            // 
            this.labelControl7.AllowHtmlString = true;
            this.labelControl7.Location = new System.Drawing.Point(449, 22);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new System.Drawing.Size(20, 13);
            this.labelControl7.TabIndex = 15;
            this.labelControl7.Text = "<color=blue>(px)</color>";
            // 
            // labelControl6
            // 
            this.labelControl6.AllowHtmlString = true;
            this.labelControl6.Location = new System.Drawing.Point(316, 22);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new System.Drawing.Size(20, 13);
            this.labelControl6.TabIndex = 14;
            this.labelControl6.Text = "<color=blue>(px)</color>";
            // 
            // calHeightFooter
            // 
            this.calHeightFooter.Location = new System.Drawing.Point(382, 19);
            this.calHeightFooter.Name = "calHeightFooter";
            this.calHeightFooter.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.calHeightFooter.Size = new System.Drawing.Size(62, 20);
            this.calHeightFooter.TabIndex = 13;
            // 
            // labelControl5
            // 
            this.labelControl5.Location = new System.Drawing.Point(345, 22);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new System.Drawing.Size(34, 13);
            this.labelControl5.TabIndex = 12;
            this.labelControl5.Text = "Độ cao";
            // 
            // btFontRequire
            // 
            this.btFontRequire.Location = new System.Drawing.Point(425, 79);
            this.btFontRequire.Name = "btFontRequire";
            this.btFontRequire.Size = new System.Drawing.Size(36, 20);
            this.btFontRequire.TabIndex = 11;
            this.btFontRequire.Text = "...";
            this.btFontRequire.Click += new System.EventHandler(this.btFontRequire_Click);
            // 
            // txtFontRequire
            // 
            this.txtFontRequire.Location = new System.Drawing.Point(249, 79);
            this.txtFontRequire.Name = "txtFontRequire";
            this.txtFontRequire.Properties.ReadOnly = true;
            this.txtFontRequire.Size = new System.Drawing.Size(170, 20);
            this.txtFontRequire.TabIndex = 10;
            // 
            // labelControl4
            // 
            this.labelControl4.Location = new System.Drawing.Point(13, 81);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(232, 13);
            this.labelControl4.TabIndex = 9;
            this.labelControl4.Text = "Định dạng phông chữ cho yêu cầu (ký, ghi rõ...)";
            // 
            // btFontFullName
            // 
            this.btFontFullName.Location = new System.Drawing.Point(425, 108);
            this.btFontFullName.Name = "btFontFullName";
            this.btFontFullName.Size = new System.Drawing.Size(36, 20);
            this.btFontFullName.TabIndex = 8;
            this.btFontFullName.Text = "...";
            this.btFontFullName.Click += new System.EventHandler(this.btFontFullName_Click);
            // 
            // labelControl3
            // 
            this.labelControl3.Location = new System.Drawing.Point(13, 110);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(186, 13);
            this.labelControl3.TabIndex = 6;
            this.labelControl3.Text = "Định dạng phông chữ cho tên người ký";
            this.labelControl3.Click += new System.EventHandler(this.labelControl3_Click);
            // 
            // btFontPosition
            // 
            this.btFontPosition.Location = new System.Drawing.Point(425, 50);
            this.btFontPosition.Name = "btFontPosition";
            this.btFontPosition.Size = new System.Drawing.Size(36, 20);
            this.btFontPosition.TabIndex = 5;
            this.btFontPosition.Text = "...";
            this.btFontPosition.Click += new System.EventHandler(this.btFontPosition_Click);
            // 
            // txtFontPosition
            // 
            this.txtFontPosition.Location = new System.Drawing.Point(249, 50);
            this.txtFontPosition.Name = "txtFontPosition";
            this.txtFontPosition.Properties.ReadOnly = true;
            this.txtFontPosition.Size = new System.Drawing.Size(170, 20);
            this.txtFontPosition.TabIndex = 4;
            // 
            // labelControl2
            // 
            this.labelControl2.Location = new System.Drawing.Point(13, 52);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(208, 13);
            this.labelControl2.TabIndex = 3;
            this.labelControl2.Text = "Định dạng phông chữ cho chức vụ người ký";
            // 
            // cheIsShowFullName
            // 
            this.cheIsShowFullName.Location = new System.Drawing.Point(11, 20);
            this.cheIsShowFullName.Name = "cheIsShowFullName";
            this.cheIsShowFullName.Properties.Caption = "Hiển thị tên của người ký";
            this.cheIsShowFullName.Size = new System.Drawing.Size(164, 19);
            this.cheIsShowFullName.TabIndex = 2;
            // 
            // calSpaceAbove
            // 
            this.calSpaceAbove.Location = new System.Drawing.Point(249, 19);
            this.calSpaceAbove.Name = "calSpaceAbove";
            this.calSpaceAbove.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.calSpaceAbove.Size = new System.Drawing.Size(61, 20);
            this.calSpaceAbove.TabIndex = 1;
            // 
            // labelControl1
            // 
            this.labelControl1.Location = new System.Drawing.Point(181, 22);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(61, 13);
            this.labelControl1.TabIndex = 0;
            this.labelControl1.Text = "Khoảng cách";
            // 
            // xucFooterReportOption
            // 
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Name = "xucFooterReportOption";
            this.Size = new System.Drawing.Size(499, 354);
            ((System.ComponentModel.ISupportInitialize)(this.gcList)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gbList)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontFullName.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.calHeightFooter.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontRequire.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtFontPosition.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheIsShowFullName.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.calSpaceAbove.Properties)).EndInit();
            this.ResumeLayout(false);

        }

        private void labelControl3_Click(object sender, EventArgs e)
        {
        }

        private void LoadFormatOption()
        {
            try
            {
                DataSet set = new DataSet();
                set.ReadXml(this.xmlFormatOptionPath);
                this.calSpaceAbove.EditValue = float.Parse(set.Tables[0].Rows[0]["SpaceAbove"].ToString());
                this.calHeightFooter.EditValue = float.Parse(set.Tables[0].Rows[0]["HeightFooter"].ToString());
                this.cheIsShowFullName.Checked = bool.Parse(set.Tables[0].Rows[0]["IsShowFullName"].ToString());
                this.txtFontPosition.Text = set.Tables[0].Rows[0]["FontPosition"].ToString();
                this.txtFontFullName.Text = set.Tables[0].Rows[0]["FontFullName"].ToString();
                this.txtFontRequire.Text = set.Tables[0].Rows[0]["FontRequire"].ToString();
            }
            catch
            {
                this.calSpaceAbove.EditValue = 40;
                this.calHeightFooter.EditValue = 70;
                this.cheIsShowFullName.Checked = true;
                this.txtFontPosition.Text = "Times New Roman, 11,25pt, style=Bold";
                this.txtFontFullName.Text = "Times New Roman, 11,25pt, style=Regular";
                this.txtFontRequire.Text = "Times New Roman, 9,25pt, style=Italic";
            }
            try
            {
                FontConverter converter = new FontConverter();
                this.txtFontPosition.Font = converter.ConvertFromString(this.txtFontPosition.Text) as Font;
                this.txtFontFullName.Font = converter.ConvertFromString(this.txtFontFullName.Text) as Font;
                this.txtFontRequire.Font = converter.ConvertFromString(this.txtFontRequire.Text) as Font;
            }
            catch
            {
            }
        }

        private void LoadListOption()
        {
            DataTable table = new DataTable();
            table.Columns.Add("Position", typeof(string));
            table.Columns.Add("FullName", typeof(string));
            table.Columns.Add("Require", typeof(string));
            table.Columns.Add("IsTimekeeper", typeof(bool));
            table.Columns.Add("IsSalary", typeof(bool));
            table.Columns.Add("IsOther", typeof(bool));
            try
            {
                DataSet set = new DataSet();
                set.ReadXml(this.xmlListOptionPath);
                foreach (DataRow row in set.Tables[0].Rows)
                {
                    table.Rows.Add(new object[] { row[0].ToString(), row[1].ToString(), row[2].ToString(), bool.Parse(row[3].ToString()), bool.Parse(row[4].ToString()), bool.Parse(row[5].ToString()) });
                }
            }
            catch
            {
            }
            this.gcList.DataSource = table;
        }

        public void LoadOption()
        {
            this.LoadFormatOption();
            this.LoadListOption();
        }

        public void Save()
        {
            this.SaveFormatOption();
            this.SaveListOption();
        }

        public void SaveFormatOption()
        {
            DataSet set = new DataSet();
            using (DataTable table = new DataTable())
            {
                table.Columns.Add("SpaceAbove", typeof(string));
                table.Columns.Add("HeightFooter", typeof(string));
                table.Columns.Add("IsShowFullName", typeof(bool));
                table.Columns.Add("FontPosition", typeof(string));
                table.Columns.Add("FontFullName", typeof(string));
                table.Columns.Add("FontRequire", typeof(string));
                table.Rows.Add(new object[0]);
                object[] objArray = new object[] { this.calSpaceAbove.EditValue.ToString(), this.calHeightFooter.EditValue.ToString(), bool.Parse(this.cheIsShowFullName.Checked.ToString()), this.txtFontPosition.Text, this.txtFontFullName.Text, this.txtFontRequire.Text };
                table.Rows[0][0] = objArray[0];
                table.Rows[0][1] = objArray[1];
                table.Rows[0][2] = objArray[2];
                table.Rows[0][3] = objArray[3];
                table.Rows[0][4] = objArray[4];
                table.Rows[0][5] = objArray[5];
                set.Tables.Add(table);
            }
            try
            {
                set.WriteXml(this.xmlFormatOptionPath);
            }
            catch
            {
            }
        }

        public void SaveListOption()
        {
            this.gbList.RefreshData();
            DataSet set = new DataSet();
            using (DataTable table = new DataTable())
            {
                table.Columns.Add("Position", typeof(string));
                table.Columns.Add("FullName", typeof(string));
                table.Columns.Add("Require", typeof(string));
                table.Columns.Add("IsTimekeeper", typeof(bool));
                table.Columns.Add("IsSalary", typeof(bool));
                table.Columns.Add("IsOther", typeof(bool));
                for (int i = 0; i < this.gbList.RowCount; i++)
                {
                    if (this.gbList.GetRowCellValue(i, this.colPosition) != null)
                    {
                        table.Rows.Add(new object[0]);
                        object[] objArray = new object[] { this.gbList.GetRowCellValue(i, this.colPosition).ToString(), this.gbList.GetRowCellValue(i, this.colFullName).ToString(), this.gbList.GetRowCellValue(i, this.colRequire).ToString(), bool.Parse(this.gbList.GetRowCellValue(i, this.colIsTimekeeper).ToString()), bool.Parse(this.gbList.GetRowCellValue(i, this.colIsSalary).ToString()), bool.Parse(this.gbList.GetRowCellValue(i, this.colIsOther).ToString()) };
                        table.Rows[i][0] = objArray[0];
                        table.Rows[i][1] = objArray[1];
                        table.Rows[i][2] = objArray[2];
                        table.Rows[i][3] = objArray[3];
                        table.Rows[i][4] = objArray[4];
                        table.Rows[i][5] = objArray[5];
                    }
                }
                set.Tables.Add(table);
            }
            try
            {
                set.WriteXml(this.xmlListOptionPath);
            }
            catch
            {
            }
        }

        private void txtFontFullName_EditValueChanged(object sender, EventArgs e)
        {
        }
    }
}

